package kr.or.kead.ui.menu;

import java.awt.Container;
import java.awt.event.ActionListener;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

import kr.or.kead.service.DaoTable;
import kr.or.kead.ui.list.AbsTablelist;

public abstract class AbsMenu extends JMenu implements ActionListener {
	private JFrame frame;
	protected int frameHeight;
	public AbsMenu(JFrame frame, String title) {
		this.frame = frame;
		initialize(title);
	}
	
	public void refreshList(AbsTablelist list) {
		Container contentPane = frame.getContentPane();
		contentPane.removeAll();		
		list.setTableModel();
		contentPane.add(list);
		setFrameSize(list);
		contentPane.validate();	
		frame.pack();
	}
	
	protected void setFrameSize(JPanel panel) {
		this.frame.setSize(panel.getPreferredSize());
		this.frame.validate();
	}
	
	
	
	protected abstract void initialize(String title);	
	
}
